package com.santu.edu.supporter.biz.good.pojo.po;

import com.santu.edu.supporter.biz.good.pojo.dto.GoodDTO;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @TableName day_day_up_good
 */
@Data
@Accessors(chain = true)
public class GoodPO implements Serializable {
    /**
     *
     */
    private Long id;

    /**
     * 商品id
     */
    private String goodId;

    /**
     * 类别id
     */
    private String categoryId;

    /**
     * 商品名称
     */
    private String goodName;

    /**
     * 商品价格
     */
    private BigDecimal price;

    /**
     * 商品图片
     */
    private String imageUrl;

    /**
     * 商品描述
     */
    private String description;

    /**
     * 商品数量
     */
    private Integer goodNum;

    /**
     * 商品状态[0:停售,1起售]
     */
    private Integer goodStatus;

    /**
     * 商品顺序
     */
    private Integer goodSort;

    /**
     *
     */
    private String gmtCreate;

    /**
     *
     */
    private String gmtModified;

    private static final long serialVersionUID = 1L;

    public static GoodPO createItem(GoodDTO dto) {
        return new GoodPO()
                .setCategoryId(dto.getCategoryId())
                .setGoodId(dto.getGoodId())
                .setGoodName(dto.getGoodName())
                .setGoodNum(dto.getGoodNum())
                .setGoodStatus(dto.getGoodStatus())
                .setGoodSort(dto.getGoodSort())
                .setImageUrl(dto.getImageUrl())
                .setDescription(dto.getDescription())
                .setPrice(dto.getPrice());
    }
}